package com.takeeasy.itembank.topic.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.takeeasy.itembank.topic.bo.TopicBO;
import com.takeeasy.platform.action.BaseAction;
import com.takeeasy.platform.annotation.Action;
import com.takeeasy.platform.dataobject.RequestDataObject;
import com.takeeasy.platform.dataobject.ResponseDataObject;
import com.takeeasy.platform.persistence.Page;

@Action(name = "TopicAction")
public class TopicAction extends BaseAction {
	private String sql;
	public ResponseDataObject query(RequestDataObject req) {
		Page page = new Page();
		page.setCurrentPage(1);
		page.setRowPerPage(10);
		page.setTotalRow(20);
		getResponseData().setPage(page);
		getResponseData().setResponseJsonString("aaaaaaaaaa");
		getDao().paginationQuery(null, page, "select * from t_topic");
		return getResponseData();
	}
	
	//获取题信息
		public ResponseDataObject getTopics(RequestDataObject req){
			Page page = null;
//			TopicBO tb = new TopicBO();
			Map<String,Object> tempMap = new HashMap<>();
			page = req.getPage();
			if (page==null || "".equals(page)) {
				page = new Page();
				page.setRowPerPage(1);
				page.setCurrentPage(1);
			}
//			page.setCurrentPage(1);
//			page.setRowPerPage(10);
//			page.setTotalRow(20);
			getResponseData().setPage(page);
//			String topic_zj = "1";
			sql = "select * from t_topic";
			List<TopicBO> list = getDao().paginationQuery(TopicBO.class, page, sql);
			System.out.println("list= "+ list);
			
			tempMap.put("topics", list);
			getResponseData().setResponseMap(tempMap);
			
			return getResponseData();
		}
}
